package com.swt.gap.common;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author sx
 */

@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum RoleEnum {

    /**
     *角色类型
     */
    SUPER(1, "超级管理员"),
    ADMIN(2, "管理员"),
    USER(3, "普通用户");

    private Integer code;
    private String name;

    public static RoleEnum getByCode(Integer code) {
        RoleEnum returnVal = null;
        for (RoleEnum roleEnum : RoleEnum.values()) {
            if (roleEnum.getCode().equals(code)) {
                returnVal = roleEnum;
                break;
            }
        }
        return returnVal;
    }
}
